package com.yidaba.ui;

import android.app.Activity;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.yidaba.activity.R;

public class MyToast {
	public static void createToast(Activity activity, String notice) {
		// LayoutInflater inflater = LayoutInflater.from(context);
		LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View toastView = inflater.inflate(R.layout.toast,(ViewGroup) activity.findViewById(R.id.toast_layout_root));
		TextView textView = (TextView) toastView.findViewById(R.id.toast_text);
		textView.setText(notice);
		Toast toast = new Toast(activity);
		toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
		toast.setDuration(Toast.LENGTH_LONG);
		toast.setView(toastView);
		toast.show();

	}
}
